package com.cndw.kongfu.messagepush;

public class KeepAlive implements Runnable {
	
	long checkDelay = 10;
    long keepAliveDelay = 2000;
    
    long lastSendTime;
    public void run() {
        while(true){
            if(System.currentTimeMillis()-lastSendTime > keepAliveDelay){
                SendTest.sendIdleMessage();
                lastSendTime = System.currentTimeMillis();
            }else{
                try {
                    Thread.sleep(checkDelay);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    
    public static void runBoss() {
    	Thread thread = new Thread(new KeepAlive());
    	thread.start();
    }
    
    

}